<style>
.data_table{
	border:1px solid #dde0e7;
	
	}
.data_table td{
	padding:5px;
	}
.base_tr td:first-child{width:160px;}	
.data_table ul{
	padding:0px;
	margin:0px;
	list-style:none;
	font-size:0.9em;
	margin-top:20px;
	}
.data_table ul li{
	padding-left:20px;
	height:28px;
	line-height:28px;
	overflow:hidden;
	}

</style>


<table class="data_table" width="600" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" scope="row" style="padding:5px; font-size:1.1em">跟进记录</td>
  </tr>
  <tr class="base_tr">
    <td scope="row" style="padding:5px; background-color:#dde0e7;">基本资料</td>
    <td style="padding:5px; font-size:0.9em;">
    
    <a style="color:#68c0ff;" href="javascript:get_data('follow',<?php echo $potential['id']?>)">跟进记录<font color="red">(<?php echo $follow_count;?>)</font></a>
    &nbsp;&nbsp;&nbsp;
    <a style="color:#68c0ff;" href="javascript:get_data('order',<?php echo $potential['id']?>)">订单列表<font color="red">(<?php echo $order_count;?>)</font></a>
    &nbsp;&nbsp;&nbsp;
    <a style="color:#68c0ff;" href="javascript:get_data('invite',<?php echo $potential['id']?>)">邀请列表<font color="red">(<?php echo $invite_count;?>)</font></a>
    </td>
  </tr>
  <tr>
    <td scope="row" valign="top">
    	<ul>
        	<li>手机:<?php echo $potential['phone']?></li>
            <li>所属油站:<?php echo $potential['gas_name']?></li>
            <li>跟进人:<?php echo $potential['server_user']?></li>
            <li>状态:<?php echo $potential['user_status']?></li>
            <li>客户来源:<?php echo $potential['third']?></li>
            <li>客户性质:<?php echo $potential['car_type']?></li>
            <li>订单数量:<?php echo $order_count?></li>	
        </ul>
    
    </td>
    <td valign="top" style="position:relative;">
    	
    	
    	<div id="data_div" style="min-height:300px;"></div>
    
    	

	<div style="margin-top:50px;">
	<input type="text" value=""  id="follow_text" placeholder="请输入跟进内容" />
     <a href="javascript:add_follow(<?php echo $potential['id']?>)" class="btn btn-info btn-sm" style="position:relative; right:0px; bottom:0px;">添加跟进</a>
     </div>
    </td>
  </tr>
</table>

<script>


function get_data(type_str,f_id){

	$.ajax({
			   type: "POST",
			   url: "<?php echo base_url().'crm/user/follow_get_data'?>",
			   data: "id="+f_id+'&type_str='+type_str,
			   success: function(msg){
				 $('#data_div').html(msg);
			   }
			});
	
	
}

get_data('follow',<?php echo $potential['id']?>);


function add_follow(f_id){
	var content=$('#follow_text').val();
	
	if(content==''){
			alert('请输入跟进内容');
			return false;
		}
	
	$.ajax({
		   type: "POST",
		   url: "<?php echo base_url().'crm/user/follow_add'?>",
		   data: "id="+f_id+'&note='+content,
		   success: function(msg){
			 get_data('follow',f_id);
			 $('#follow_text').val('');
		   }
	});

}


</script>
